﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Entity;

namespace WoChu.RfClient.Duty
{
    public class TakeStockUIRule
    {
        private static TakeStockUIRule _NewInstance = new TakeStockUIRule();

        public static TakeStockUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new TakeStockUIRule();
                }

                return _NewInstance;
            }
        }

        public List<GoodsInfo> GetGoodsInfo(string userID)
        {
            try
            {
                List<GoodsInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ITakeStock>.NewInstance.InvokeWebMethod<List<GoodsInfo>>("GetGoodsInfo", new object[] { userID });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }

        public List<GoodsInfo> GetLocationInfo(string userID)
        {
            try
            {
                List<GoodsInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ITakeStock>.NewInstance.InvokeWebMethod<List<GoodsInfo>>("GetLocationInfo", new object[] { userID });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }

        public OutPutParams<bool> InsertTakeStock(string userID, List<TakeStockInfo> lstTakeStock)
        {
            try
            {
                OutPutParams<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ITakeStock>.NewInstance.InvokeWebMethod<List<TakeStockInfo>, OutPutParams<bool>>("InsertTakeStock", new object[] { userID }, lstTakeStock);

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        } 
    }
}
